import mergeSort from "../../../utils/sortingAlgorithms/mergeSort.mjs";
import { getRootComparator } from "./registry.mjs";
export var DO_NOT_SWAP = 0;
export var FIRST_BEFORE_SECOND = -1;
export var FIRST_AFTER_SECOND = 1;
/**
 * @param {Array} indexesWithData The data to sort.
 * @param {string} rootComparatorId The comparator logic to use.
 * @param {Array} argsForRootComparator Additional arguments for comparator function.
 */

export function sort(indexesWithData, rootComparatorId) {
  var rootComparator = getRootComparator(rootComparatorId);

  for (var _len = arguments.length, argsForRootComparator = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
    argsForRootComparator[_key - 2] = arguments[_key];
  }

  mergeSort(indexesWithData, rootComparator.apply(void 0, argsForRootComparator));
}